package com.yanqu.road.server.cmd.activity.suitang;

import com.yanqu.road.entity.player.UserBaseInfo;
import com.yanqu.road.logic.pb.PlayerBasePb;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.TongBingProto;
import com.yanqu.road.pb.activity.suitang.SuiTang;
import com.yanqu.road.server.cmd.CrossUnionCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manager.activity.suitang.CrossSuiTangMgr;
import com.yanqu.road.server.manager.activity.suitang.activity.CrossSuiTangActivity;
import com.yanqu.road.server.manager.activity.tongbing.CrossTongBingMgr;
import com.yanqu.road.server.manager.activity.tongbing.activity.CrossTongBingActivity;
import com.yanqu.road.server.manager.user.CrossUserMgr;
import com.yanqu.road.server.protocol.CrossProtocol;

@Cmd(code = CrossProtocol.C2_CROSS_SUI_TANG_LOGIN, desc = "")
public class CrossSuiTangLoginCmd extends CrossUnionCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        SuiTang.CrossSuiTangLoginReqMsg reqMsg = SuiTang.CrossSuiTangLoginReqMsg.parseFrom(packet.getBytes());

        // 更新userBaseInfo
        UserBaseInfo userBaseInfo = PlayerBasePb.parseBaseUserInfo(reqMsg.getUserBaseInfo());
        CrossUserMgr.updateUserBaseInfo(packet.getPlayerId(), userBaseInfo);

        CrossSuiTangActivity activity = CrossSuiTangMgr.getActivity(reqMsg.getActivityId(), groupId);
        if (activity == null) {
            return true;
        }
        activity.loginByCmd(packet.getPlayerId(), reqMsg);
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {

    }

    @Override
    public void sendData() {

    }
}
